<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.net/jquery/1.10.2/jquery.min.js"></script>
    <style>
        table{
            margin: 50px auto;
            border: 2px solid #ddd;
            border-collapse: collapse;
        }
        td,th{
            border: 2px solid #ddd;
            padding: 20px;
            text-align: center;
        }
        th{
            background: #eee;
        }
    </style>
</head>
<body>
    <table id="table">
        <tr><th>部门编号</th>
            <th>部门名称</th>
        </tr>
    </table>
<script>
    infor();
    function infor (){
        let list = [];
        $.ajax({
            type:"POST",
            url:"/getdeptmes",
            data:{},
            success:function (res){
                list = res;
                let table = $("#table")
                for (let i = 0; i < list.length; i++) {
                    let row = $("<tr></tr>")
                    row.append($("<td></td>").text(list[i].deptid))
                    row.append($("<td></td>").text(list[i].dname))
                    table.append(row)
                }
            }
        })
    }
</script>
</body>
</html>
